#ifndef INVITEEXPERT_H
#define INVITEEXPERT_H

#include <QWidget>
#include "User.h"
#include "../../DB/InvitationHandler.h"

class RoomHandler;

class MainWindow;     // 前向声明

namespace Ui {
class InviteExpert;
}

class InviteExpert : public QWidget
{
    Q_OBJECT

public:
    InviteExpert(RoomHandler* roomHandler, QWidget *parent = nullptr);
    ~InviteExpert();

    InvitationHandler* invitationHandler;
    quint16 roomId;

protected:
    void showEvent(QShowEvent *event) override;

private:
    Ui::InviteExpert *ui;
    RoomHandler* roomHandler;
    void addRow(const quint16& userId, const QString &ticket);

public slots:
    void recvExperts(const QByteArray& data);
    void recvInvitation(const QByteArray& data);

private slots:
    void onInviteBtnClicked(const quint16& userId);       //点击邀请按钮
    void onJoinBtnClicked(const quint16& roomId);

signals:
    void inviteRequested(const QString &expertName);
};

#endif // INVITEEXPERT_H
